var dbs = ["GovernanceDW_B", "GovernanceDW_A"];

var fullProfileCompanyIds = db.getSiblingDB('GovernanceInputFile')
    .getCollection('GovernancePdfProfileMetadata')
    .find({ GovernancePdfType: 1 })
    .map((it) => {
        return it.CompanyId;
    });

dbs.forEach(function(database) {

    db.getSiblingDB(database).getCollection('GovernanceCompanyProfile').update({}, { $set: { FullProfile: false } }, { multi: true, upsert: false })

    fullProfileCompanyIds.forEach(function(id) {
        db.getSiblingDB(database).getCollection('GovernanceCompanyProfile').update({ _id: id }, { $set: { FullProfile: true } }, { multi: false, upsert: false });
    })
});